#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
using namespace std;

const int N = 3000000;
const double pi = acos(-1.0);

int maxl = 1, l = 0;
int n, m;
int cvt[N];

inline int read() {
	register int ch = getchar(), res = 0;
	while (!isdigit(ch)) ch = getchar();
	while (isdigit(ch)) {
		res = (res << 3) + (res << 1) + ch - '0';
		ch = getchar();
	}
	return res;
}

struct Complex {
	double real, imag;
	Complex(double _real = 0.0, double _imag = 0.0) { real = _real, imag = _imag; }
	friend Complex operator+(const Complex &a, const Complex &b) {
		return Complex(a.real + b.real, a.imag + b.imag);
	}
	friend Complex operator-(const Complex &a, const Complex &b) {
		return Complex(a.real - b.real, a.imag - b.imag);
	}
	friend Complex operator*(const Complex &a, const Complex &b) {
		return Complex(a.real * b.real - a.imag * b.imag, a.real * b.imag + a.imag * b.real);
	}
} f[N], g[N];

inline void fft(bool opt, Complex *A) {
	for (register int i = 0; i < maxl; ++i)
		if (i < cvt[i]) swap(A[i], A[cvt[i]]);
	for (register int j = 2; j <= maxl; j <<= 1) {
		register int mid = j >> 1;
		Complex wn(cos(2.0 * pi / j), opt ? sin(2.0 * pi / j) : -sin(2.0 * pi / j));
		for (register int k = 0; k < maxl; k = k + j) {
			Complex w(1, 0);
			for (register int h = 0; h < mid; ++h, w = w * wn) {
				Complex tmp = A[k + h];
				A[k + h] = A[k + h] + w * A[k + h + mid];
				A[k + h + mid] = tmp - w * A[k + h + mid];
			}
		}
	}
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
	freopen("testdata.in", "r", stdin);
	freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
	freopen("FFT.in", "r", stdin);
	freopen("FFT.out", "w", stdout);
#endif
#endif

	n = read(), m = read();
	while (maxl < n + m + 1) {
		maxl <<= 1;
		++l;
	}
	for (register int i = 0; i <= n; ++i) {
		f[i].real = read();
	}
	for (register int i = 0; i <= m; ++i) {
		g[i].real = read();
	}
	for (register int i = 0; i < maxl; ++i) {
		cvt[i] = (cvt[i >> 1] >> 1 | ((i & 1) << (l - 1)));
	}
	fft(true, f);
	fft(true, g);
	for (register int i = 0; i <= maxl; ++i) {
		f[i] = f[i] * g[i];
	}
	fft(false, f);
	for (register int i = 0; i <= n + m; ++i) {
		printf("%d ", (int)(f[i].real / maxl + 0.5));
	}
	return 0;
}